﻿' ******************************************************************************
' ** 
' **  Yahoo Finance Managed
' **  Written by Marius Häusler 2010
' **  It would be pleasant, if you contact me when you are using this code.
' **  Contact: YahooFinanceManaged@gmail.com
' **  Project Home: http://code.google.com/p/yahoo-finance-managed/
' **  
' ******************************************************************************
' **  
' **  Copyright 2010 Marius Häusler
' **  
' **  Licensed under the Apache License, Version 2.0 (the "License");
' **  you may not use this file except in compliance with the License.
' **  You may obtain a copy of the License at
' **  
' **    http://www.apache.org/licenses/LICENSE-2.0
' **  
' **  Unless required by applicable law or agreed to in writing, software
' **  distributed under the License is distributed on an "AS IS" BASIS,
' **  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' **  See the License for the specific language governing permissions and
' **  limitations under the License.
' ** 
' ******************************************************************************


Namespace Finance

    ''' <summary>
    ''' Stores market quote informations
    ''' </summary>
    ''' <remarks></remarks>
    Public Class MarketQuoteData

        Private mName As String = String.Empty
        Private mOneDayPriceChangePercent, mMarketCapitalizationInMillion, mPriceToFreeCashFlow, mNetProfitMarginPercent, mPriceToBookValue, mLongTermDeptToEquity, mDividendYieldPercent, mPriceEarningsRatio, mReturnOnEquityPercent As Double

        ''' <summary>
        ''' The name of the sector, industry or company.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Name() As String
            Get
                Return mName
            End Get
            Set(ByVal value As String)
                mName = value
            End Set
        End Property
        Public Property OneDayPriceChangePercent() As Double
            Get
                Return mOneDayPriceChangePercent
            End Get
            Set(ByVal value As Double)
                mOneDayPriceChangePercent = value
            End Set
        End Property
        Public Property MarketCapitalizationInMillion() As Double
            Get
                Return mMarketCapitalizationInMillion
            End Get
            Set(ByVal value As Double)
                mMarketCapitalizationInMillion = value
            End Set
        End Property
        Public Property PriceEarningsRatio() As Double
            Get
                Return mPriceEarningsRatio
            End Get
            Set(ByVal value As Double)
                mPriceEarningsRatio = value
            End Set
        End Property
        Public Property ReturnOnEquityPercent() As Double
            Get
                Return mReturnOnEquityPercent
            End Get
            Set(ByVal value As Double)
                mReturnOnEquityPercent = value
            End Set
        End Property
        Public Property DividendYieldPercent() As Double
            Get
                Return mDividendYieldPercent
            End Get
            Set(ByVal value As Double)
                mDividendYieldPercent = value
            End Set
        End Property
        Public Property LongTermDeptToEquity() As Double
            Get
                Return mLongTermDeptToEquity
            End Get
            Set(ByVal value As Double)
                mLongTermDeptToEquity = value
            End Set
        End Property
        Public Property PriceToBookValue() As Double
            Get
                Return mPriceToBookValue
            End Get
            Set(ByVal value As Double)
                mPriceToBookValue = value
            End Set
        End Property
        Public Property NetProfitMarginPercent() As Double
            Get
                Return mNetProfitMarginPercent
            End Get
            Set(ByVal value As Double)
                mNetProfitMarginPercent = value
            End Set
        End Property
        Public Property PriceToFreeCashFlow() As Double
            Get
                Return mPriceToFreeCashFlow
            End Get
            Set(ByVal value As Double)
                mPriceToFreeCashFlow = value
            End Set
        End Property
        ''' <summary>
        ''' All market quote properties.
        ''' </summary>
        ''' <param name="prp">The market quote property you want to get or set.</param>
        ''' <value></value>
        ''' <returns>A value representing and depending on the passed property.</returns>
        ''' <remarks></remarks>
        Public Property Values(ByVal prp As MarketQuoteProperty) As Object
            Get
                Select Case prp
                    Case MarketQuoteProperty.Name : Return mName
                    Case MarketQuoteProperty.DividendYieldPercent : Return mDividendYieldPercent
                    Case MarketQuoteProperty.LongTermDeptToEquity : Return mLongTermDeptToEquity
                    Case MarketQuoteProperty.MarketCapitalizationInMillion : Return mMarketCapitalizationInMillion
                    Case MarketQuoteProperty.NetProfitMarginPercent : Return mNetProfitMarginPercent
                    Case MarketQuoteProperty.OneDayPriceChangePercent : Return mOneDayPriceChangePercent
                    Case MarketQuoteProperty.PriceEarningsRatio : Return mPriceEarningsRatio
                    Case MarketQuoteProperty.PriceToBookValue : Return mPriceToBookValue
                    Case MarketQuoteProperty.PriceToFreeCashFlow : Return mPriceToFreeCashFlow
                    Case MarketQuoteProperty.ReturnOnEquityPercent : Return mReturnOnEquityPercent
                    Case Else : Return Nothing
                End Select
            End Get
            Set(ByVal value As Object)
                Select Case prp
                    Case MarketQuoteProperty.Name : mName = value.ToString
                    Case MarketQuoteProperty.DividendYieldPercent : Double.TryParse(value.ToString, mDividendYieldPercent)
                    Case MarketQuoteProperty.LongTermDeptToEquity : Double.TryParse(value.ToString, mLongTermDeptToEquity)
                    Case MarketQuoteProperty.MarketCapitalizationInMillion : Double.TryParse(value.ToString, mMarketCapitalizationInMillion)
                    Case MarketQuoteProperty.NetProfitMarginPercent : Double.TryParse(value.ToString, mNetProfitMarginPercent)
                    Case MarketQuoteProperty.OneDayPriceChangePercent : Double.TryParse(value.ToString, mOneDayPriceChangePercent)
                    Case MarketQuoteProperty.PriceEarningsRatio : Double.TryParse(value.ToString, mPriceEarningsRatio)
                    Case MarketQuoteProperty.PriceToBookValue : Double.TryParse(value.ToString, mPriceToBookValue)
                    Case MarketQuoteProperty.PriceToFreeCashFlow : Double.TryParse(value.ToString, mPriceToFreeCashFlow)
                    Case MarketQuoteProperty.ReturnOnEquityPercent : Double.TryParse(value.ToString, mReturnOnEquityPercent)
                End Select
            End Set
        End Property

    End Class

End Namespace
